import {
  axios
} from '@/utils/request'
/**
       * 流程管理-流程设计api
    */

// 流程设计分页列表查询
function getFlowDesinTableData (data) {
  return axios({
    url: '/workflow-manage/definition/page',
    method: 'get',
    params: data
  })
}
// 新增流程设计
function addFlowDesin (data) {
  return axios({
    url: '/workflow-manage/definition',
    method: 'post',
    data
  })
}
// 删除流程设计
function deleteFlowDesin (ids) {
  return axios({
    url: '/workflow-manage/definition',
    method: 'delete',
    data: {
      definitionIds: ids
    }
  })
}
// 修改流程设计
function editFlowDesin (data) {
  return axios({
    url: '/workflow-manage/definition',
    method: 'put',
    data
  })
}

// 获取流程设计详情
function getFlowDesinDetail (processId) {
  return axios({
    url: '/workflow-manage/definition/' + processId,
    method: 'get'
  })
}

// 读取流程图的xmldata
function getFlowDesinXmlData (processId) {
  return axios({
    url: '/workflow-manage/definition/readXml/' + processId,
    method: 'get'
  })
}

// 读取流程详情(不包含流程图)
function getFlowDesinBaseInfoData (processId) {
  return axios({
    url: '/workflow-manage/definition/detail/' + processId,
    method: 'get'
  })
}

// 获取升级策略业务对应的流程图xml数据
function getPoliceFlowDesinXmlData () {
  return axios({
    url: '/workflow-manage/definition/xml/strategy_audit',
    method: 'get'
  })
}

function getPoliceFlowDesinXmlDataNewly () {
  return axios({
    url: '/workflow-manage/definition/xml/testcar_audit',
    method: 'get'
  })
}

// 获取升级策略业务对应的流程图节点信息
function getPoliceFlowDesinNodeData () {
  return axios({
    url: '/workflow-manage/definition/element/strategy_audit',
    method: 'get'
  })
}

// 获取任务业务对应的流程图xml数据
function getTaskFlowDesinXmlData () {
  return axios({
    url: '/workflow-manage/definition/xml/task_audit',
    method: 'get'
  })
}

// 获取追加车辆业务对应的流程图xml数据
function getAddCarFlowDesinXmlData () {
  return axios({
    url: '/workflow-manage/definition/xml/addcar_audit',
    method: 'get'
  })
}

// 获取测试车辆新建流程图
function getTestCarFlowDesinXmlData (Process) {
  return axios({
    url: '/workflow-manage/definition/xml/' + Process,
    method: 'get'
  })
}
// 获取任务业务对应的流程图节点数据
function getTaskFlowDesinNodeDataNewly (Process) {
  return axios({
    url: '/workflow-manage/definition/element/' + Process,
    method: 'get'
  })
}
// 获取任务业务对应的流程图节点数据
function getTaskFlowDesinNodeData () {
  return axios({
    url: '/workflow-manage/definition/element/task_audit',
    method: 'get'
  })
}
// 获取服务业务对应的流程图xml数据
function getServiceFlowDesinXmlData () {
  return axios({
    url: '/workflow-manage/definition/xml/service_audit',
    method: 'get'
  })
}
// 获取用户注册对应的流程图节点数据
function getUserRegister () {
  return axios({
    url: '/workflow-manage/definition/element/user_register',
    method: 'get'
  })
}
// 获取服务业务对应的流程图节点数据
function getServiceFlowDesinNodeData () {
  return axios({
    url: '/workflow-manage/definition/element/service_audit',
    method: 'get'
  })
}

// 获取追加车辆业务对应的流程图节点数据
function getAddCarFlowDesinNodeData () {
  return axios({
    url: '/workflow-manage/definition/element/addcar_audit',
    method: 'get'
  })
}

// 获取测试车辆业务对应的流程图节点数据
// 新建
function getTestCarFlowDesinNodeData () {
  return axios({
    url: '/workflow-manage/definition/element/testcar_audit',
    method: 'get'
  })
}
// 停用
function getTestCarFlowDesinNodeDataStop () {
  return axios({
    url: '/workflow-manage/definition/element/testcar_audit_stop',
    method: 'get'
  })
}
// 恢复
function getTestCarFlowDesinNodeDataResume () {
  return axios({
    url: '/workflow-manage/definition/element/testcar_audit_resume',
    method: 'get'
  })
}
// 删除
function getTestCarFlowDesinNodeDataDelete () {
  return axios({
    url: '/workflow-manage/definition/element/testcar_audit_delete',
    method: 'get'
  })
}

// 获取软件管控业务对应的流程图xml数据
function getSoftwareMCFlowDesinXmlData () {
  return axios({
    url: '/workflow-manage/definition/xml/sw_repo_audit',
    method: 'get'
  })
}

// 获取软件管控业务对应的流程图节点信息
function getSoftwareMCFlowDesinNodeData () {
  return axios({
    url: '/workflow-manage/definition/element/sw_repo_audit',
    method: 'get'
  })
}

// 获取业务审核流程信息(xml和节点信息---查看审核功能需要)
function getFlowInstanceDetail (params) {
  return axios({
    url: '/workflow-manage/instance/detail',
    method: 'get',
    params
  })
}
// 获取业务审核流程信息，未发起审核前
function getDraftFlowInstanceDetail (params) {
  return axios({
    url: '/workflow-manage/instance/element/' + params.businessCode + '/' + params.businessKey,
    method: 'get'
  })
}
export default {
  getFlowDesinTableData,
  addFlowDesin,
  deleteFlowDesin,
  editFlowDesin,
  getFlowDesinDetail,
  getFlowDesinXmlData,
  getFlowDesinBaseInfoData,
  getPoliceFlowDesinXmlData,
  getPoliceFlowDesinNodeData,
  getTaskFlowDesinXmlData,
  getTaskFlowDesinNodeData,
  getServiceFlowDesinXmlData,
  getServiceFlowDesinNodeData,
  getFlowInstanceDetail,
  getSoftwareMCFlowDesinXmlData,
  getSoftwareMCFlowDesinNodeData,
  getDraftFlowInstanceDetail,
  getAddCarFlowDesinNodeData,
  getAddCarFlowDesinXmlData,
  getTaskFlowDesinNodeDataNewly,
  getPoliceFlowDesinXmlDataNewly,
  getTestCarFlowDesinXmlData,
  getTestCarFlowDesinNodeData,
  getTestCarFlowDesinNodeDataStop,
  getTestCarFlowDesinNodeDataResume,
  getTestCarFlowDesinNodeDataDelete,
  getUserRegister
}
